import { initMixin } from './init'
import { stateMixin } from './state'
import { renderMixin } from './render'
import { eventsMixin } from './events'
import { lifecycleMixin } from './lifecycle'
import { warn } from '../util/index'

function Vue (options) {
  if (process.env.NODE_ENV !== 'production' &&
    !(this instanceof Vue)
  ) {
    warn('Vue is a constructor and should be called with the `new` keyword')
  }
  this._init(options)
}

/**
 * 在Vue的原型上
 *    挂载_init
 */
initMixin(Vue)

/**
 * 在Vue原型上
 *    挂载代理属性$data和$props, 真实对应this._data和this._props
 *    挂载$set和$delete
 *    挂载$watch
 */
stateMixin(Vue)

/**
 * 在Vue原型上
 *    挂载$on, $once, $off, $emit
 */
eventsMixin(Vue)

/**
 * 在Vue原型上
 *    挂载_update, $forceUpdate, $destroy
 */
lifecycleMixin(Vue)

/**
 * 在Vue原型上
 *    挂载:
 *    _o, 
 *    _n,
 *    _s,
 *    _l,
 *    _t,
 *    _q,
 *    _i,
 *    _m,
 *    _f,
 *    _k,
 *    _b,
 *    _v,
 *    _e,
 *    _u,
 *    _g,
 *    _d,
 *    _p,
 *    $nextTick
 *    _render
 */
renderMixin(Vue)

export default Vue
